package com.qf.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {

    @Bean // 创建交换机
    public Exchange bootExchange(){
        return ExchangeBuilder.topicExchange("boot_exchange").build();
    }

    @Bean // 创建队列
    public Queue bootQueue(){
        return QueueBuilder.durable("boot_queue").build();
    }

    @Bean // 绑定交换机和队列
    public Binding bootBinding(Queue bootQueue,Exchange bootExchange){
        return BindingBuilder.bind(bootQueue).to(bootExchange).with("*.big.rabbit").noargs();
    }
}
